#ifndef __JB_NANOSIC__H__
#define __JB_NANOSIC__H__

#ifdef __cplusplus
extern "C" {
#endif

typedef void (*VoiceDataCb)(char* pBuf,int length);
typedef void (*VoiceKeyCb)(unsigned int keyCode);


typedef enum{
	EVT_KEYCODE,
	EVT_VOICE,
	EVT_UNKOWN,
}EM_EVT_TYPE;

typedef struct{
	int keycode;
}ST_Key;

typedef struct{
	char* buf;
	int   length;
}ST_Voice;

typedef struct{
	EM_EVT_TYPE type;
	union{
		ST_Key      Key;
		ST_Voice    Voice;
	}u;
}ST_Event;

/*-----------------------------------------------------------------------------
Function Name:	Nano_Open
Input		:	
Output		:	
Return 		:	0		成功
				其它   失败
Describe		:	lib 初始化
-------------------------------------------------------------------------------*/
int Nano_Open(void);

/*-----------------------------------------------------------------------------
Function Name:	Nano_Close
Input		:
Output		:
Return 		:	0		成功
				其它   失败
Describe		:	lib 关闭
-------------------------------------------------------------------------------*/
int Nano_Close(void);

/*-----------------------------------------------------------------------------
Function Name:	Nano_BeginPollProcessing
Input		:


Output		:
Return 		:
Describe		:	收取事件
-------------------------------------------------------------------------------*/
ST_Event* Nano_BeginPollProcessing(void);

/*-----------------------------------------------------------------------------
Function Name:	Nano_EndPollProcessing
Input		:


Output		:
Return 		:
Describe		:	销毁事件
-------------------------------------------------------------------------------*/
void Nano_EndPollProcessing(ST_Event* Evt);

/*-----------------------------------------------------------------------------
Function Name:	Nano_Connected
Input			:

Output		:
Return 		:	1 : 设备已连接，0:无设备连接
Describe		:
-------------------------------------------------------------------------------*/
int Nano_Connected(void);


/*-----------------------------------------------------------------------------
Function Name:	Nano_RegisterDataReceivedCb
Input		:	处理数据的回调函数
Return 		:
Describe	:	注册处理数据的回调函数
-------------------------------------------------------------------------------*/
void Nano_RegisterDataReceivedCb(VoiceDataCb func);

/*-----------------------------------------------------------------------------
Function Name:	Nano_RegisterVoiceKeyCb
Input		:	处理按键的回调函数
Return 		:
Describe	:	注册处理按键的回调函数
-------------------------------------------------------------------------------*/
void Nano_RegisterVoiceKeyCb(VoiceKeyCb func);

/*-----------------------------------------------------------------------------
Function Name:	Nano_appProcUsbData
Input		:	dataIn:需要处理的USB音频数据。datalen:数据的长度
Return 		:
Describe	:	解包解码USB音频数据
-------------------------------------------------------------------------------*/
int Nano_appProcUsbData(char* dataIn,char datalen);


#ifdef __cplusplus
}
#endif


#endif
